package com.joysuch.wwyt.edu.enums;

/**
 * 培训人员签到状态
 */
public enum TrainingUserSignStatus {

    ONLINE(0, "未签到"), OFFLINE(1, "已签到"),
    UN_SIGN_IN(2,"无需签到");

    private int id;
    private String name;

    TrainingUserSignStatus(int id, String name) {
        this.id = id;
        this.name = name;
    }

    public int getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public static TrainingUserSignStatus findByName(String name) {
        TrainingUserSignStatus[] values = TrainingUserSignStatus.values();
        for (TrainingUserSignStatus v : values) {
            if (v.getName().equals(name)) {
                return v;
            }
        }
        return null;
    }

    public static TrainingUserSignStatus findById(Integer level) {
        TrainingUserSignStatus[] values = TrainingUserSignStatus.values();
        for (TrainingUserSignStatus v : values) {
            if (v.getId() == level) {
                return v;
            }
        }
        return null;
    }

    public static String findNameById(Integer id) {
        if (id == null) {
            return null;
        }
        TrainingUserSignStatus[] values = TrainingUserSignStatus.values();
        for (TrainingUserSignStatus v : values) {
            if (v.getId() == id) {
                return v.getName();
            }
        }
        return null;
    }
}
